<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('库存表列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
<!--                        <li>-->
<!--                            <label class="is-required">仓库：</label>-->
<!--                            <select id="warehouseId" name="warehouseId" th:with="type=${session.warehouse}">-->
<!--                                &lt;!&ndash;								<option   th:value="${session.warehouseId}" th:text="${@dict.getDictLabel('${session.warehouseId}')}"></option>&ndash;&gt;-->
<!--                                <option th:each="dict : ${type}" th:text="${dict.warehouseName}"-->
<!--                                        th:value="${dict.warehouseId}"></option>-->
<!--                            </select>-->
<!--                        </li>-->

                        <li>
                            <label>仓库：</label>
                            <select name="warehouseId" th:with="type=${@dict.getType('is_house')}" required>
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </li>

                        <li>
                            <label>入库单号：</label>
                            <input type="text" name="stockinId"/>
                        </li>

                        <li>
                            <label>作业号：</label>
                            <input type="text" name="jobId"/>
                        </li>

                        <li>
                            <label>货位编码：</label>
                            <input type="text" name="cargoSpaceId"/>
                        </li>
                        <li>
                            <label>物品编码：</label>
                            <input type="text" name="productId"/>
                        </li>
                        <li>
                            <label>物料名称：</label>
                            <input type="text" name="lineId"/>
                        </li>
                        <li>
                            <label>托盘条码：</label>
                            <input type="text" name="trayCode"/>
                        </li>
                        <li>
                            <label>WMS下发单号：</label>
                            <input type="text" name="productStatus"/>
                        </li>
                        <li>
                            <label>入库时间：</label>
                            <input type="text" class="time-input" data-type="datetime" placeholder="请单击选择开始时间："
                                   name="startTime" id="inStartTime"/>---
                            <input type="text" class="time-input" data-type="datetime" placeholder="请单击选择结束时间："
                                   name="finishTime" id="inFinishTime"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm"
                               onclick="$.table.search('formId','bootstrap-table')"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm"
                               onclick="$.form.reset('formId','bootstrap-table')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="stock:stock:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"
               shiro:hasPermission="stock:stock:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="stock:stock:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="stock:stock:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-bordered" style="overflow:scroll;width: 100%">
            <table id="bootstrap-table" class="table text-nowrap" style="min-width: 100%"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('stock:stock:edit')}]];
    var removeFlag = [[${@permission.hasPermi('stock:stock:remove')}]];
    var product_status = [[${@dict.getType('product_status')}]];
    var warehouse = [[${@dict.getType('is_house')}]];
    var inType = [[${@dict.getType('in_or_out')}]];
    var prefix = ctx + "stock/stock";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "库存表",
            search: false,
            height: $("#div").height() / 1,
            pageSize: 10,
            pageList: [10, 25, 50],
            clickToSelect: true,//是否启用点击选中行
            uniqueId: "stockId",//表主键(用于修改和删除)
            sortName: "stockId",//必加排序 sortOrder: "asc"默认
            columns: [
                {
                    halign: 'center',
                    align: 'center',
                    checkbox: true
                },
                {
                    field: 'stockId',
                    title: '库存编码',
                    halign: 'center',
                    align: 'center'
                },
                {
                    field: 'cargoSpaceId',
                    title: '货位编码',
                    halign: 'center',
                    align: 'center',
                    visible: false
                },
                {
                    field: 'cargoSpaceName',
                    title: '货位名称',
                    halign: 'center',
                    align: 'center'
                },
                {
                    field: 'trayCode',
                    title: '托盘条码',
                    halign: 'center',
                    align: 'center'
                },

                {
                    field: 'productId',
                    title: '物品编码',
                    halign: 'center',
                    align: 'center'
                },

                {
                    field: 'stockinId',
                    title: '入库单号',
                    halign: 'center',
                    align: 'center'
                },

                {
                    field: 'jobId',
                    title: '作业号',
                    halign: 'center',
                    align: 'center'
                },

                {
                    field: 'lineId',
                    title: '物品名称',
                    halign: 'center',
                    align: 'center'
                },
                {
                    field: 'lotNo',
                    title: '批号',
                    halign: 'center',
                    align: 'center'
                },
                {
                    field: 'productStatus',
                    title: 'WMS下发单号',
                    align: 'center',
                },
                {
                    field: 'inClassName',
                    title: '供应商',
                    halign: 'center',
                    align: 'center'
                },
                {
                    field: 'quantity',
                    title: '库存数量',
                    halign: 'center',
                    align: 'center'
                }, {
                    field: 'inClassId',
                    title: '库存重量',
                    halign: 'center',
                    align: 'center'
                },

                {
                    field: 'inType',
                    title: '入库类型',
                    halign: 'center',
                    align: 'center',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(inType, value);
                    }
                },
                {
                    field: 'classId',
                    title: '生产时间',
                    halign: 'center',
                    align: 'center'
                }, {
                    field: 'inDate',
                    title: '入库日期',
                    halign: 'center',
                    align: 'center'
                },
                {
                    field: 'backDate',
                    title: '回流日期',
                    halign: 'center',
                    align: 'center'
                },

                {
                    field: 'warehouseId',
                    title: '仓库',
                    align: 'center',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(warehouse, value);
                    }
                }, {
                    field: 'stackingId',
                    title: '暂存单号',
                    align: 'center',

                },


                {
                    title: '操作',
                    halign: 'center',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs '  + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.stockId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs '  + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.stockId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>